package server.connection;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class ConnectionReceiver extends Thread{

	private final ServerSocket serverSocket;
	private final ThreadGroup threadGroup;
	
	private boolean kill = false;
	
	public ConnectionReceiver(ThreadGroup threadGroup, ServerSocket serverSocket)
	{
		this.serverSocket = serverSocket;
		this.threadGroup = threadGroup;
	}
	
	@Override
	public void run() {
		
		while(!kill)
		{
			try {
				Socket cs = serverSocket.accept();
				System.out.println("client connected!");
				ClientConnection con = new ClientConnection(serverSocket, cs); 
				con.start();
				
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} //warten auf neuen Client
			
		}
		
	}

}
